<?php

namespace App\Exceptions;

use Exception;
use Throwable;

class ApiException extends Exception
{
    public $data;

    public function __construct($message = "", $code = 1, $data = null, Throwable $previous = null)
    {
        $codeList = config('errcode.' . $code);
        $message = $message ? : (isset($codeList['code']) ? $codeList['msg'] : '');
        parent::__construct($message, $code, $previous);
        $this->data = $data;
    }
}
